Creating a custom preview window

FastReport displays reports in the standard preview window. If it does not suit you for some reason, a custom preview form may be created. For this purpose, the “TfrxPreview” component from the FastReport component palette was designed. To display a report, the link to this component should be assigned to the “TfrxReport.Preview” property.

There is two typical problems when using TfrxPreview component. It does not handle keys (arrows, PgUp, PgDown etc) and mouse wheel (if any). To make TfrxPreview working with keys, pass the focus to it (it can be done, for example, in the OnShow event handler of a form):

frxPreview.SetFocus;

To make TfrxPreview working with mouse scroll, you have to create OnMouseWheel event handler of a form and call TfrxPreview.MouseWheelScroll method in this handler:

procedure TForm1.FormMouseWheel(Sender: TObject; Shift: TShiftState;

WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);

begin

frxPreview1.MouseWheelScroll(WheelDelta);

end;